package com.example.springmvcdemo1;

import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@RequestMapping("/request")
@RestController
public class RequestController {
    @RequestMapping("r10")
    public String r10(@RequestBody Student student) {
        return "接收到参数, student:" + student.toString();
    }

    @RequestMapping("/article/{articleId}")
    public String r11(@PathVariable("articleId") Integer articleId) {
        return "接收到参数,articleId:" + articleId;
    }

    @RequestMapping("/article/{articleId}/{name}")
    public String r12(@PathVariable("articleId") Integer articleId,@PathVariable("name") String name) {
        return "接收到参数,articleId:" + articleId + " , name:" + name;
    }

    @RequestMapping("/r13")
    public String r13(MultipartFile imgFile) {
        String originalFilename = imgFile.getOriginalFilename();
        return "接收到参数,文件名: " + originalFilename;
    }
}
